from helpers.director.shortcut import director_element
from django.utils.translation import ugettext as _

@director_element('permit.options')
def get_permit(ui=None): 
    return [
        {'label':'质量事件',
         'children':[
            {'label':'质量事件界面','value':'QualityEvent.edit'},
            #{'label':'质量事件界面','value':'QualityEvent'},
            {'label':'事件上报','value':'event.create','depend':['QualityEvent.edit']},
            #{'label':'编辑技术工艺','value':'event.tech.edit','depend':['QualityEvent.edit']},
            {'label':'不良内容','value':'event.fail_content.edit','depend':['QualityEvent.edit']},
            
            {'label':'编辑质量验证','value':'event.validate.edit','depend':['QualityEvent.edit']},
            {'label':'编辑总经办','value':'event.approval.edit','depend':['QualityEvent.edit']},
            {'label':'直接关闭事件','value':'can_direct_close_event',},
            
            #{'label':'关闭','value':'event.close'},
         ]},        
        
        {'label':'生产批次',
            'children':[
                {'label':'查看','value':'ProdRecord'},
                {'label':'编辑','value':'ProdRecord.edit','depend':['ProdRecord']},
                ]},
        {'label':'基础数据',
         'children':[
             {'label':'不合格来源','children':[
                {'label':'查看','value':'FailSource'},
                {'label':'编辑','value':'FailSource.edit','depend':['FailSource']},
             ]},
             {'label':'不合格种类','children':[
                {'label':'查看','value':'FailKind'},
                {'label':'编辑','value':'FailKind.edit','depend':['FailKind']},             
             ]},
             {'label':'解决方案','children':[
                {'label':'查看','value':'ProcessingScheme'},
                {'label':'编辑','value':'ProcessingScheme.edit','depend':['ProcessingScheme']},                          
             ]},
             {'label':'商品信息','children':[
                {'label':'查看','value':'ProdModel'},
                {'label':'编辑','value':'ProdModel.edit','depend':['ProdModel']},                          
             ]},
             {'label':'不良简述','children':[
                {'label':'查看','value':'FailAbstract'},
                {'label':'编辑','value':'FailAbstract.edit','depend':['FailAbstract']},                          
             ]},
         ]
         },
        {'label':'数据分析',
            'children':[
                {'label':'图表分析','value':'ansys_data'},
                {'label':'质量事件分析','value':'quality_event_ansys'},
                      ]},
        
        {'label':'系统管理','help_text':'一下权限一般情况下请不要暴露给普通用户',
         'children':[
             {'label':'部门管理','children':[
                {'label':'查看','value':'DepartMent'},
                {'label':'编辑','value':'DepartMent.edit','depend':['DepartMent']},
                ]},
             {'label':'人员编辑','children':[
                 {'label':'查看','value':'user-read'},
                 {'label':'编辑','value':'user-edit','depend':['user-read']},
                 ]},
             {'label':'权限组','children':[
                 {'label':'查看','value':'Group','depend':['user-read']},
                 {'label':'编辑','value':'Group.edit','depend':['Group',]},
             ]},
            #{'label': '人员管理', 'value': 'User.read',}, 
            #{'label': '用户编辑', 'value': 'User.write',}, 
         ]}
    ]